package com.shop.domain.user;

import com.alibaba.fastjson.annotation.JSONField;
import com.shop.jpa.domain.BaseDomain;
import com.shop.jpa.support.JpaConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>UserPinkBill 实体类</p>
 * <p>Table: t_user_pink_bill - 用户账单表</p>
 * @author generator
 * @date 2021-02-21 04:50:37
 */
@ApiModel("SleepPinkBill 实体类")
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "t_sleep_pink_bill")
@SQLDelete(sql = "update t_sleep_pink_bill set is_deleted = 1 where id = ?")
@Where(clause = JpaConst.WHERE_CLAUSE_NOT_DELETED)
@DynamicInsert(true)
@DynamicUpdate(true)
public class SleepPinkBill extends BaseDomain implements Serializable {

    @ApiModelProperty(value = "id", hidden = true)
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
	@JSONField(serialize=false)
    private Long id;

    /**
	 * 用户uid
	 */
    @ApiModelProperty("用户uid")
	@Column(name = "uid")
    private Long uid;

    /**
	 * 关联id
	 */
    @ApiModelProperty("关联id")
	@Column(name = "link_id")
    private Long linkId;

    /**
	 * 拼团id
	 */
    @ApiModelProperty("拼团id")
	@Column(name = "pink_id")
    private Long pinkId;



    /**
     * 金额
     */
    @ApiModelProperty("金额")
    @Column(name = "price")
    private BigDecimal price;


    /**
	 * 备注
	 */
    @ApiModelProperty("备注")
	@Column(name = "mark")
    private String mark;


    /**
     * 流水类型 0收入 1支出
     */
    @ApiModelProperty("流水类型 0收入 1支出")
    @Column(name = "pm")
    private Integer pm;

    /**
     * 流水分类
     */
    @ApiModelProperty("业务类型 ")
    @Column(name = "table_name")
    private String tableName;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @Column(name = "create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
	 * 是否删除
	 */
    @ApiModelProperty("是否删除")
	@Column(name = "is_deleted")
    @JSONField(serialize=false)
    private Integer isDeleted;
}